.class public Lcom/netease/newsreader/util/NeteaseHttpClient;
.super Ljava/lang/Object;
.source "NeteaseHttpClient.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/NeteaseHttpClient$GzipDecompressingEntity;
    }
.end annotation


# static fields
.field private static final ENTRY_BODY:I = 0x1

.field private static final ENTRY_COUNT:I = 0x2

.field private static final ENTRY_METADATA:I = 0x0

.field private static final IF_MODIFIED_SINCE:Ljava/lang/String; = "If-Modified-Since"

.field private static final INT_ENTRY:I = 0x1

.field private static final INT_MODIFIED_SINCE:I = 0x0

.field private static final LAST_MODIFIED:Ljava/lang/String; = "Last-Modified"

.field private static TAG:Ljava/lang/String; = null

.field private static final VERSION:I = 0x311f2

.field private static cache:Lcom/jakewharton/DiskLruCache; = null

.field private static connection_timeout:J = 0x0L

.field private static final httpCacheSize:J = 0xa00000L

.field private static httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

.field private static maxPerRouter:I

.field private static maxTotalConnections:I

.field private static retryCount:I


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    .line 60
    const/16 v0, 0xa

    sput v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->maxTotalConnections:I

    .line 61
    const/16 v0, 0x14

    sput v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->maxPerRouter:I

    .line 62
    const-string v0, "NeteaseHttpClient"

    sput-object v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->TAG:Ljava/lang/String;

    .line 73
    const/4 v0, 0x1

    sput v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->retryCount:I

    .line 74
    const-wide/32 v0, 0xea60

    sput-wide v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->connection_timeout:J

    .line 116
    const/4 v0, 0x0

    sput-object v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    .line 59
    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 75
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 76
    return-void
.end method

.method static synthetic access$0()I
    .locals 1

    .prologue
    .line 73
    sget v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->retryCount:I

    return v0
.end method

.method public static getCache(Landroid/content/Context;)Lcom/jakewharton/DiskLruCache;
    .locals 1
    .parameter "mContext"

    .prologue
    .line 96
    invoke-static {p0}, Lcom/netease/newsreader/util/NeteaseHttpClient;->initCache(Landroid/content/Context;)V

    .line 97
    sget-object v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    return-object v0
.end method

.method public static declared-synchronized getHttpClient(Lorg/apache/http/params/HttpParams;)Lorg/apache/http/impl/client/DefaultHttpClient;
    .locals 9
    .parameter "params"

    .prologue
    .line 118
    const-class v5, Lcom/netease/newsreader/util/NeteaseHttpClient;

    monitor-enter v5

    :try_start_0
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    if-nez v4, :cond_0

    .line 121
    new-instance v3, Lorg/apache/http/conn/scheme/SchemeRegistry;

    invoke-direct {v3}, Lorg/apache/http/conn/scheme/SchemeRegistry;-><init>()V

    .line 122
    .local v3, schReg:Lorg/apache/http/conn/scheme/SchemeRegistry;
    new-instance v4, Lorg/apache/http/conn/scheme/Scheme;

    const-string v6, "http"

    .line 123
    invoke-static {}, Lorg/apache/http/conn/scheme/PlainSocketFactory;->getSocketFactory()Lorg/apache/http/conn/scheme/PlainSocketFactory;

    move-result-object v7

    const/16 v8, 0x50

    invoke-direct {v4, v6, v7, v8}, Lorg/apache/http/conn/scheme/Scheme;-><init>(Ljava/lang/String;Lorg/apache/http/conn/scheme/SocketFactory;I)V

    .line 122
    invoke-virtual {v3, v4}, Lorg/apache/http/conn/scheme/SchemeRegistry;->register(Lorg/apache/http/conn/scheme/Scheme;)Lorg/apache/http/conn/scheme/Scheme;

    .line 124
    new-instance v4, Lorg/apache/http/conn/scheme/Scheme;

    const-string v6, "https"

    .line 125
    invoke-static {}, Lorg/apache/http/conn/ssl/SSLSocketFactory;->getSocketFactory()Lorg/apache/http/conn/ssl/SSLSocketFactory;

    move-result-object v7

    const/16 v8, 0x1bb

    invoke-direct {v4, v6, v7, v8}, Lorg/apache/http/conn/scheme/Scheme;-><init>(Ljava/lang/String;Lorg/apache/http/conn/scheme/SocketFactory;I)V

    .line 124
    invoke-virtual {v3, v4}, Lorg/apache/http/conn/scheme/SchemeRegistry;->register(Lorg/apache/http/conn/scheme/Scheme;)Lorg/apache/http/conn/scheme/Scheme;

    .line 126
    sget-wide v6, Lcom/netease/newsreader/util/NeteaseHttpClient;->connection_timeout:J

    invoke-static {p0, v6, v7}, Lorg/apache/http/conn/params/ConnManagerParams;->setTimeout(Lorg/apache/http/params/HttpParams;J)V

    .line 127
    new-instance v1, Lorg/apache/http/conn/params/ConnPerRouteBean;

    sget v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->maxPerRouter:I

    invoke-direct {v1, v4}, Lorg/apache/http/conn/params/ConnPerRouteBean;-><init>(I)V

    .line 128
    .local v1, connPerRoute:Lorg/apache/http/conn/params/ConnPerRouteBean;
    invoke-static {p0, v1}, Lorg/apache/http/conn/params/ConnManagerParams;->setMaxConnectionsPerRoute(Lorg/apache/http/params/HttpParams;Lorg/apache/http/conn/params/ConnPerRoute;)V

    .line 129
    sget v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->maxTotalConnections:I

    invoke-static {p0, v4}, Lorg/apache/http/conn/params/ConnManagerParams;->setMaxTotalConnections(Lorg/apache/http/params/HttpParams;I)V

    .line 130
    sget-object v4, Lorg/apache/http/HttpVersion;->HTTP_1_1:Lorg/apache/http/HttpVersion;

    invoke-static {p0, v4}, Lorg/apache/http/params/HttpProtocolParams;->setVersion(Lorg/apache/http/params/HttpParams;Lorg/apache/http/ProtocolVersion;)V

    .line 132
    new-instance v0, Lorg/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager;

    invoke-direct {v0, p0, v3}, Lorg/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager;-><init>(Lorg/apache/http/params/HttpParams;Lorg/apache/http/conn/scheme/SchemeRegistry;)V

    .line 133
    .local v0, conMgr:Lorg/apache/http/conn/ClientConnectionManager;
    new-instance v4, Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-direct {v4, v0, p0}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>(Lorg/apache/http/conn/ClientConnectionManager;Lorg/apache/http/params/HttpParams;)V

    sput-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    .line 136
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    new-instance v6, Lcom/netease/newsreader/util/NeteaseHttpClient$1;

    invoke-direct {v6}, Lcom/netease/newsreader/util/NeteaseHttpClient$1;-><init>()V

    invoke-virtual {v4, v6}, Lorg/apache/http/impl/client/DefaultHttpClient;->addRequestInterceptor(Lorg/apache/http/HttpRequestInterceptor;)V

    .line 145
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    new-instance v6, Lcom/netease/newsreader/util/NeteaseHttpClient$2;

    invoke-direct {v6}, Lcom/netease/newsreader/util/NeteaseHttpClient$2;-><init>()V

    invoke-virtual {v4, v6}, Lorg/apache/http/impl/client/DefaultHttpClient;->addResponseInterceptor(Lorg/apache/http/HttpResponseInterceptor;)V

    .line 166
    new-instance v2, Lcom/netease/newsreader/util/NeteaseHttpClient$3;

    invoke-direct {v2}, Lcom/netease/newsreader/util/NeteaseHttpClient$3;-><init>()V

    .line 184
    .local v2, myRetryHandler:Lorg/apache/http/client/HttpRequestRetryHandler;
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-virtual {v4, v2}, Lorg/apache/http/impl/client/DefaultHttpClient;->setHttpRequestRetryHandler(Lorg/apache/http/client/HttpRequestRetryHandler;)V

    .line 186
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    new-instance v6, Lcom/netease/newsreader/util/NeteaseHttpClient$4;

    invoke-direct {v6}, Lcom/netease/newsreader/util/NeteaseHttpClient$4;-><init>()V

    invoke-virtual {v4, v6}, Lorg/apache/http/impl/client/DefaultHttpClient;->setKeepAliveStrategy(Lorg/apache/http/conn/ConnectionKeepAliveStrategy;)V

    .line 210
    .end local v0           #conMgr:Lorg/apache/http/conn/ClientConnectionManager;
    .end local v1           #connPerRoute:Lorg/apache/http/conn/params/ConnPerRouteBean;
    .end local v2           #myRetryHandler:Lorg/apache/http/client/HttpRequestRetryHandler;
    .end local v3           #schReg:Lorg/apache/http/conn/scheme/SchemeRegistry;
    :goto_0
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v5

    return-object v4

    .line 208
    :cond_0
    :try_start_1
    sget-object v4, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-virtual {v4, p0}, Lorg/apache/http/impl/client/DefaultHttpClient;->setParams(Lorg/apache/http/params/HttpParams;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 118
    :catchall_0
    move-exception v4

    monitor-exit v5

    throw v4
.end method

.method public static getforCache(Lorg/apache/http/client/methods/HttpGet;)Ljava/lang/String;
    .locals 1
    .parameter "request"

    .prologue
    .line 226
    if-eqz p0, :cond_0

    .line 227
    invoke-static {p0}, Lcom/netease/newsreader/util/NeteaseHttpClient;->handlerStatusCode(Lorg/apache/http/client/methods/HttpGet;)Ljava/lang/String;

    move-result-object v0

    .line 229
    :goto_0
    return-object v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private static handlerStatusCode(Lorg/apache/http/client/methods/HttpGet;)Ljava/lang/String;
    .locals 13
    .parameter "request"

    .prologue
    .line 238
    :try_start_0
    invoke-virtual {p0}, Lorg/apache/http/client/methods/HttpGet;->getURI()Ljava/net/URI;

    move-result-object v11

    invoke-virtual {v11}, Ljava/net/URI;->toString()Ljava/lang/String;

    move-result-object v10

    .line 239
    .local v10, uri:Ljava/lang/String;
    invoke-static {v10}, Lcom/netease/newsreader/util/NeteaseHttpClient;->uriToKey(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 242
    .local v5, key:Ljava/lang/String;
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11, v5}, Lcom/jakewharton/DiskLruCache;->get(Ljava/lang/String;)Lcom/jakewharton/DiskLruCache$Snapshot;

    move-result-object v8

    .line 243
    .local v8, snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    if-eqz v8, :cond_0

    .line 244
    const/4 v11, 0x0

    invoke-virtual {v8, v11}, Lcom/jakewharton/DiskLruCache$Snapshot;->getString(I)Ljava/lang/String;

    move-result-object v4

    .line 245
    .local v4, ims:Ljava/lang/String;
    if-eqz v4, :cond_0

    .line 246
    const-string v11, "If-Modified-Since"

    invoke-virtual {p0, v11, v4}, Lorg/apache/http/client/methods/HttpGet;->setHeader(Ljava/lang/String;Ljava/lang/String;)V

    .line 249
    .end local v4           #ims:Ljava/lang/String;
    :cond_0
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-virtual {v11, p0}, Lorg/apache/http/impl/client/DefaultHttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v3

    .line 250
    .local v3, httpResponse:Lorg/apache/http/HttpResponse;
    invoke-interface {v3}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v11

    invoke-interface {v11}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v9

    .line 251
    .local v9, statuscode:I
    const/4 v7, 0x0

    .line 254
    .local v7, rest:Ljava/lang/String;
    sparse-switch v9, :sswitch_data_0

    .line 310
    .end local v3           #httpResponse:Lorg/apache/http/HttpResponse;
    .end local v5           #key:Ljava/lang/String;
    .end local v7           #rest:Ljava/lang/String;
    .end local v8           #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .end local v9           #statuscode:I
    .end local v10           #uri:Ljava/lang/String;
    :cond_1
    :goto_0
    return-object v7

    .line 256
    .restart local v3       #httpResponse:Lorg/apache/http/HttpResponse;
    .restart local v5       #key:Ljava/lang/String;
    .restart local v7       #rest:Ljava/lang/String;
    .restart local v8       #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .restart local v9       #statuscode:I
    .restart local v10       #uri:Ljava/lang/String;
    :sswitch_0
    const/4 v2, 0x0

    .line 257
    .local v2, entity:Lorg/apache/http/HttpEntity;
    invoke-interface {v3}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v2

    .line 258
    if-eqz v2, :cond_1

    .line 259
    const-string v11, "UTF-8"

    invoke-static {v2, v11}, Lorg/apache/http/util/EntityUtils;->toString(Lorg/apache/http/HttpEntity;Ljava/lang/String;)Ljava/lang/String;
    :try_end_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_3

    move-result-object v7

    .line 261
    const/4 v1, 0x0

    .line 262
    .local v1, editor:Lcom/jakewharton/DiskLruCache$Editor;
    :try_start_1
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11, v5}, Lcom/jakewharton/DiskLruCache;->edit(Ljava/lang/String;)Lcom/jakewharton/DiskLruCache$Editor;

    move-result-object v1

    .line 263
    const-string v11, "Last-Modified"

    invoke-interface {v3, v11}, Lorg/apache/http/HttpResponse;->getLastHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v6

    .line 264
    .local v6, last_modify_header:Lorg/apache/http/Header;
    if-nez v6, :cond_2

    .line 265
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11, v5}, Lcom/jakewharton/DiskLruCache;->remove(Ljava/lang/String;)Z

    .line 276
    :goto_1
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11}, Lcom/jakewharton/DiskLruCache;->flush()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_1 .. :try_end_1} :catch_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2

    goto :goto_0

    .line 277
    .end local v6           #last_modify_header:Lorg/apache/http/Header;
    :catch_0
    move-exception v0

    .line 279
    .local v0, e:Ljava/lang/Exception;
    :try_start_2
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_2
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_3

    goto :goto_0

    .line 300
    .end local v0           #e:Ljava/lang/Exception;
    .end local v1           #editor:Lcom/jakewharton/DiskLruCache$Editor;
    .end local v2           #entity:Lorg/apache/http/HttpEntity;
    .end local v3           #httpResponse:Lorg/apache/http/HttpResponse;
    .end local v5           #key:Ljava/lang/String;
    .end local v7           #rest:Ljava/lang/String;
    .end local v8           #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .end local v9           #statuscode:I
    .end local v10           #uri:Ljava/lang/String;
    :catch_1
    move-exception v0

    .line 302
    .local v0, e:Lorg/apache/http/client/ClientProtocolException;
    invoke-virtual {v0}, Lorg/apache/http/client/ClientProtocolException;->printStackTrace()V

    .line 310
    .end local v0           #e:Lorg/apache/http/client/ClientProtocolException;
    :goto_2
    const/4 v7, 0x0

    goto :goto_0

    .line 267
    .restart local v1       #editor:Lcom/jakewharton/DiskLruCache$Editor;
    .restart local v2       #entity:Lorg/apache/http/HttpEntity;
    .restart local v3       #httpResponse:Lorg/apache/http/HttpResponse;
    .restart local v5       #key:Ljava/lang/String;
    .restart local v6       #last_modify_header:Lorg/apache/http/Header;
    .restart local v7       #rest:Ljava/lang/String;
    .restart local v8       #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .restart local v9       #statuscode:I
    .restart local v10       #uri:Ljava/lang/String;
    :cond_2
    if-eqz v7, :cond_3

    :try_start_3
    const-string v11, ""

    invoke-virtual {v11, v7}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v11

    if-nez v11, :cond_3

    .line 268
    const/4 v11, 0x0

    invoke-interface {v6}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v1, v11, v12}, Lcom/jakewharton/DiskLruCache$Editor;->set(ILjava/lang/String;)V

    .line 269
    const/4 v11, 0x1

    invoke-virtual {v1, v11, v7}, Lcom/jakewharton/DiskLruCache$Editor;->set(ILjava/lang/String;)V

    .line 270
    invoke-virtual {v1}, Lcom/jakewharton/DiskLruCache$Editor;->commit()V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_2

    goto :goto_1

    .line 303
    .end local v1           #editor:Lcom/jakewharton/DiskLruCache$Editor;
    .end local v2           #entity:Lorg/apache/http/HttpEntity;
    .end local v3           #httpResponse:Lorg/apache/http/HttpResponse;
    .end local v5           #key:Ljava/lang/String;
    .end local v6           #last_modify_header:Lorg/apache/http/Header;
    .end local v7           #rest:Ljava/lang/String;
    .end local v8           #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .end local v9           #statuscode:I
    .end local v10           #uri:Ljava/lang/String;
    :catch_2
    move-exception v0

    .line 305
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_2

    .line 272
    .end local v0           #e:Ljava/io/IOException;
    .restart local v1       #editor:Lcom/jakewharton/DiskLruCache$Editor;
    .restart local v2       #entity:Lorg/apache/http/HttpEntity;
    .restart local v3       #httpResponse:Lorg/apache/http/HttpResponse;
    .restart local v5       #key:Ljava/lang/String;
    .restart local v6       #last_modify_header:Lorg/apache/http/Header;
    .restart local v7       #rest:Ljava/lang/String;
    .restart local v8       #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .restart local v9       #statuscode:I
    .restart local v10       #uri:Ljava/lang/String;
    :cond_3
    :try_start_4
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11, v5}, Lcom/jakewharton/DiskLruCache;->remove(Ljava/lang/String;)Z
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_4 .. :try_end_4} :catch_1
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_2

    goto :goto_1

    .line 285
    .end local v1           #editor:Lcom/jakewharton/DiskLruCache$Editor;
    .end local v2           #entity:Lorg/apache/http/HttpEntity;
    .end local v6           #last_modify_header:Lorg/apache/http/Header;
    :sswitch_1
    if-eqz v8, :cond_4

    .line 286
    const/4 v11, 0x1

    :try_start_5
    invoke-virtual {v8, v11}, Lcom/jakewharton/DiskLruCache$Snapshot;->getString(I)Ljava/lang/String;

    move-result-object v7

    goto :goto_0

    .line 289
    :cond_4
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11, v5}, Lcom/jakewharton/DiskLruCache;->remove(Ljava/lang/String;)Z

    .line 290
    sget-object v11, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v11}, Lcom/jakewharton/DiskLruCache;->flush()V
    :try_end_5
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_5 .. :try_end_5} :catch_1
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_2
    .catch Ljava/lang/Exception; {:try_start_5 .. :try_end_5} :catch_3

    goto :goto_0

    .line 306
    .end local v3           #httpResponse:Lorg/apache/http/HttpResponse;
    .end local v5           #key:Ljava/lang/String;
    .end local v7           #rest:Ljava/lang/String;
    .end local v8           #snapshot:Lcom/jakewharton/DiskLruCache$Snapshot;
    .end local v9           #statuscode:I
    .end local v10           #uri:Ljava/lang/String;
    :catch_3
    move-exception v0

    .line 308
    .local v0, e:Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_2

    .line 254
    :sswitch_data_0
    .sparse-switch
        0xc8 -> :sswitch_0
        0x130 -> :sswitch_1
    .end sparse-switch
.end method

.method public static initCache(Landroid/content/Context;)V
    .locals 6
    .parameter "mContext"

    .prologue
    .line 103
    :try_start_0
    sget-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    if-nez v1, :cond_0

    .line 104
    invoke-virtual {p0}, Landroid/content/Context;->getCacheDir()Ljava/io/File;

    move-result-object v1

    const v2, 0x311f2

    const/4 v3, 0x2

    const-wide/32 v4, 0xa00000

    invoke-static {v1, v2, v3, v4, v5}, Lcom/jakewharton/DiskLruCache;->open(Ljava/io/File;IIJ)Lcom/jakewharton/DiskLruCache;

    move-result-object v1

    sput-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    .line 106
    :cond_0
    sget-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;

    invoke-virtual {v1}, Lcom/jakewharton/DiskLruCache;->isClosed()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 107
    invoke-virtual {p0}, Landroid/content/Context;->getCacheDir()Ljava/io/File;

    move-result-object v1

    const v2, 0x311f2

    const/4 v3, 0x2

    const-wide/32 v4, 0xa00000

    invoke-static {v1, v2, v3, v4, v5}, Lcom/jakewharton/DiskLruCache;->open(Ljava/io/File;IIJ)Lcom/jakewharton/DiskLruCache;

    move-result-object v1

    sput-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->cache:Lcom/jakewharton/DiskLruCache;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 114
    :cond_1
    :goto_0
    return-void

    .line 109
    :catch_0
    move-exception v0

    .line 111
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_0
.end method

.method private static print(Ljava/lang/String;)V
    .locals 1
    .parameter "msg"

    .prologue
    .line 92
    sget-object v0, Lcom/netease/newsreader/util/NeteaseHttpClient;->TAG:Ljava/lang/String;

    invoke-static {v0, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 93
    return-void
.end method

.method public static printHeader([Lorg/apache/http/Header;)V
    .locals 4
    .parameter "headers"

    .prologue
    .line 81
    if-eqz p0, :cond_0

    .line 83
    const/4 v0, 0x0

    .local v0, index:I
    :goto_0
    array-length v2, p0

    if-lt v0, v2, :cond_1

    .line 89
    .end local v0           #index:I
    :cond_0
    return-void

    .line 85
    .restart local v0       #index:I
    :cond_1
    aget-object v1, p0, v0

    .line 86
    .local v1, one:Lorg/apache/http/Header;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-interface {v1}, Lorg/apache/http/Header;->getName()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-interface {v1}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Lcom/netease/newsreader/util/NeteaseHttpClient;->print(Ljava/lang/String;)V

    .line 83
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public static releaseNeteaseHttpClient()V
    .locals 4

    .prologue
    .line 214
    sget-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    if-eqz v1, :cond_0

    .line 215
    sget-object v1, Lcom/netease/newsreader/util/NeteaseHttpClient;->httpclient:Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-virtual {v1}, Lorg/apache/http/impl/client/DefaultHttpClient;->getConnectionManager()Lorg/apache/http/conn/ClientConnectionManager;

    move-result-object v0

    .line 216
    .local v0, conmanager:Lorg/apache/http/conn/ClientConnectionManager;
    if-eqz v0, :cond_0

    .line 217
    invoke-interface {v0}, Lorg/apache/http/conn/ClientConnectionManager;->closeExpiredConnections()V

    .line 218
    const-wide/16 v1, 0x14

    sget-object v3, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-interface {v0, v1, v2, v3}, Lorg/apache/http/conn/ClientConnectionManager;->closeIdleConnections(JLjava/util/concurrent/TimeUnit;)V

    .line 222
    :cond_0
    return-void
.end method

.method private static uriToKey(Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .parameter "uri"

    .prologue
    .line 315
    :try_start_0
    const-string v3, "MD5"

    invoke-static {v3}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v2

    .line 316
    .local v2, messageDigest:Ljava/security/MessageDigest;
    sget-object v3, Lcom/netease/newsreader/util/Charsets;->UTF_8:Ljava/nio/charset/Charset;

    invoke-static {p0, v3}, Lcom/netease/newsreader/util/Strings;->getBytes(Ljava/lang/String;Ljava/nio/charset/Charset;)[B

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/security/MessageDigest;->digest([B)[B

    move-result-object v1

    .line 317
    .local v1, md5bytes:[B
    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/netease/newsreader/util/Strings;->bytesToHexString([BZ)Ljava/lang/String;
    :try_end_0
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v3

    return-object v3

    .line 318
    .end local v1           #md5bytes:[B
    .end local v2           #messageDigest:Ljava/security/MessageDigest;
    :catch_0
    move-exception v0

    .line 319
    .local v0, e:Ljava/security/NoSuchAlgorithmException;
    new-instance v3, Ljava/lang/AssertionError;

    invoke-direct {v3, v0}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V

    throw v3
.end method
